package com.ytjj.qmyx.admin.dao;

import com.ytjj.qmyx.admin.model.request.BankerAddressRequest;
import com.ytjj.qmyx.admin.model.request.ReturnGoodsRequest;
import com.ytjj.qmyx.admin.model.request.ReturnGoodsSyncRequest;
import com.ytjj.qmyx.admin.model.response.*;
import com.ytjj.qmyx.mall.model.ReturnGoods;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 
 * 
 * @Version: 1.0
 */
public interface ReturnGoodsDao {

	List<ReturnGoodsResponse> selectList(ReturnGoodsRequest request);

	ReturnProductDetail getProductInfo(Integer id);

	ReturnOrdersDetail getOrdersInfo(Integer id);

	ReturnServiceDetail getServiceInfo(Integer id);

	ReturnBankerDetail getBankerInfo(Integer id);

	ReturnGoodsTime getExpressInfo(Integer id);

	Integer auditSuccess(@Param("id") Integer id,
					  @Param("serviceId") Integer serviceId, @Param("serviceName") String serviceName);

	Integer auditFail(@Param("id") Integer id, @Param("serviceRemarks") String serviceRemarks,
				   @Param("serviceApplyId") Integer serviceApplyId, @Param("serviceApplyName") String serviceApplyName);

	void synvReturnInfo(ReturnGoodsSyncRequest request);

	Integer getReturnStatus(Integer id);

	ReturnGoods getReturnGoodsById(Integer id);

	ReturnGoods getReturnGoodsByOid(Integer ordersInfoId);

	Integer returnGoodsSuccess(Integer id);

	List<Integer> syncInfoData();

	BigDecimal getSpecPrice(@Param("productId") Integer productId, @Param("skuSpec") String skuSpec);

	List<ReturnGoods> queryWaitSyncInfoData();

	List<ReturnGoods> queryWaitSyncInfoDataByMarkers();

	List<ReturnGoods> queryReturnGoodsByid(Integer id);

    void updateReFundSuccess(Integer ordersInfoId);

    List<ReturnGoods> selectReturnGoodsDataByIds(@Param("returnGoodsIds") List<Integer> returnGoodsIds);

	Integer deleteReturnGoods(@Param("id") Integer id);

	ReturnGoods selectById(@Param("id") Integer id);

    ReturnGoods selectByOrdersInfoId(@Param("ordersInfoId") Integer ordersInfoId);

    ReturnGoods selectByOrdersInfoIdNoStatus(@Param("ordersInfoId") Integer ordersInfoId);

    ReturnGoods selectReturnGoodsByWaitBackAmount(@Param("ordersInfoId") Integer ordersInfoId);

    Integer updateByServiceNo(ReturnGoods returnGoods);

	Integer selectAddressId(Integer productId);

	Integer creat(ReturnGoods returnGoods);

	List<BankerAddressResponse> selectByTel(BankerAddressRequest request);



	void updateBankerProductAddressId(@Param("bankerProductId")Integer bankerProductId,@Param("addressId") Integer addressId);

	void insertAll(BankerAddressRequest request);

	void updateReturnGoodsAddressId(@Param("returnGoodsId")Integer returnGoodsId,
									@Param("addressId")Integer addressId,
									@Param("reasonType")String reasonType,
									@Param("refundFare")Integer refundFare,
									@Param("refundFareOther")String refundFareOther,
									@Param("serviceDesc")String serviceDesc,
									@Param("returnOrderNo")String returnOrderNo,
									@Param("returnExpressCompany")String returnExpressCompany,
									@Param("returnExpressNo")String returnExpressNo,
									@Param("status") Integer status,
									@Param("serviceBeizhu")String serviceBeizhu,
									@Param("returnExpressTime") Date returnExpressTime,
									@Param("receivingPhone") String receivingPhone,
									@Param("receivingPerson") String receivingPerson,
									@Param("receivingAddress") String receivingAddress,
									@Param("relatedPhone") String relatedPhone,
									@Param("serviceStatus") Integer serviceStatus,
									@Param("serviceApplyTime") Date serviceApplyTime,
									@Param("serviceApplyName") String serviceApplyName,
									@Param("serviceApplyId") Integer serviceApplyId
									);

	Integer getAddressByAddressId(Integer id);

	List<BankerAddressResponse> getAddressById(Integer id);

	ReturnGoods selectByOrderInfoId(Integer ordersInfoId);

	/**
	 * 未撤销的售后单
	 */
	List<ReturnGoods> getListByOrderInfoId(Integer ordersInfoId);

    Integer findByBankerOrderId(String orderNo);

	ReturnGoodsResponse  selectByServiceNo(String serviceNo);

	/**
	 * 查询售后单状态
	 */
	List<Integer> selectReturnGoodStatus(@Param("ids")List<Integer> ids);

	/**
	 * 获取锁单子订单号
	 */
	List<Integer> getLockOrderInfo(@Param("orderInfoIdList")List<Integer> orderInfoIdList);

	/**
	 * 获取锁单子订单号
	 */
	List<ReturnGoods> getListByOrderInfoIds(@Param("orderInfoIdList")List<Integer> orderInfoIdList);

	String getReturnAutoAmount(String account);
}
